package com.mlingdu.streamer_task.streamer;

import android.util.Log;

/**
 * Created by wjy on 2018/10/7.
 */

public class Publisher {
    private CameraView mCameraView;

    public Publisher(CameraView view) {
        mCameraView = view;
        mCameraView.setPreviewCallback(new CameraView.PreviewCallback() {
            @Override
            public void onGetRgbaFrame(byte[] data, int width, int height) {
                //回调数据给Encoder
            }
        });
    }

    public void startCamera() {
        if (mCameraView.startCamera() == false) {
            Log.e("Publisher", "startCamera error");
        }

    }

    public void stopCamera() {
        mCameraView.stopCamera();
    }

    public void startAudio() {}

    public void stopAudio() {

    }

    public void setPreviewResolution(int width, int height) {
        int resolution[] = mCameraView.setPreviewResolution(width, height);
    }
}
